/**
 * Created by baiguiren on 1/25/17.
 */

let async = require('async');
let fs = require('fs');

// using apply
// 以下代码会在当前目录生成两个文件名为testfile1, testfile2的文件,
// 内容分别是test1, test2
async.parallel([
  async.apply(fs.writeFile, __dirname + '/testfile1', 'test1'),
  async.apply(fs.writeFile, __dirname + '/testfile2', 'test2')
]);

// the same process without using apply
async.parallel([
  (callback)=>{fs.writeFile(__dirname + '/testfile1', 'test1', callback)},
  (callback)=>{fs.writeFile(__dirname + '/testfile2', 'test2', callback)}
]);

// It's possible to pass any number of additional arguments
// when calling the continuation